import { http } from '@/utils/axios';
import { Base } from '@/types/modules/base';
import { Venue } from '@/types/modules/venue';

const Api = {
  page: '/v1/venue/class-room/page',
  create: '/v1/venue/class-room/create',
  modify: '/v1/venue/class-room/modify',
  remove: '/v1/venue/class-room',
  detail: '/v1/venue/class-room/detail',
};

export function detail(id: string) {
  return http.request<Venue.ClassroomInfo>({
    url: `${Api.detail}/${id}`,
    method: 'GET',
  });
}

export function page(data: Venue.QueryClassroomInfoReq) {
  return http.request<Base.PageResult<Venue.AnnouncementInfo>>({
    url: Api.page,
    method: 'POST',
    data,
  });
}

export function create(data: Venue.ClassroomInfo) {
  return http.request({
    url: Api.create,
    method: 'POST',
    data,
  });
}

export function modify(data: Venue.ClassroomInfo) {
  return http.request({
    url: Api.modify,
    method: 'POST',
    data,
  });
}

export function remove(id: string) {
  return http.request({
    url: `${Api.remove}/${id}`,
    method: 'DELETE',
  });
}
